<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
	
class mdl_general extends CI_Model { 
	
	function __construct() {
		parent::__construct();
		$this->db	= $this->load->database('default', TRUE);
	}

	#ex akses : $this->mgeneral->getWhere(array('field1'=>'data','field2'=>'data'),'nama_tabel');
	#$typeresult : n, 1
	function getWhere($where, $tabel, $typeresult='n', $order_field='', $order_tipe='') {
		if (!empty($where)) $this->db->where($where);
		if ($order_field!='' && $order_tipe!='') $this->db->order_by($order_field,$order_tipe);
		$q = $this->db->get($tabel); # echo $this->db->last_query();
		return ($typeresult=='n' ? $q->result() : $q->row());
	}
}

